// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0.
// See the LICENCE file in the repository root for full licence text.

.avatar {
  @default-avatar-size: 70px;

  .reset-input();
  .default-box-shadow();
  .default-border-radius();

  width: @default-avatar-size;
  height: @default-avatar-size;
  flex: none;

  background-color: #333;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  display: block;

  &--beatmapset {
    .default-border-radius();
    margin-right: 5px;
    width: @beatmapset-avatar-size;
    height: @beatmapset-avatar-size;
  }

  &--centered {
    margin-left: auto;
    margin-right: auto;
  }

  &--dynamic-size {
    height: 1em;
    width: 1em;
  }

  &--forum {
    width: 100%;
    height: 0;
    padding-bottom: 100%;
    border-radius: 20px;

    box-shadow: none;
  }

  &--forum-reply {
    @avatar: 60px;

    align-self: flex-end;
    width: @avatar;
    height: @avatar;
    border: 3px solid #fff;
    margin-right: 10px;
  }

  &--forum-small {
    flex: none;
    width: @forum-post--xs-avatar;
    height: @forum-post--xs-avatar;
    box-shadow: none;
  }

  &--full {
    width: 100%;
    height: 0;
    padding-bottom: 100%;
    box-shadow: none;
    border-radius: 0;
  }

  &--full-circle {
    width: 100%;
    height: 0;
    padding-bottom: 100%;
    box-shadow: none;
    border-radius: 50%;
  }

  &--full-rounded {
    width: 100%;
    height: 0;
    padding-bottom: 100%;
    box-shadow: none;
  }

  &--guest {
    .at2x-simple("~@images/layout/avatar-guest.png");
  }

  &--join-channel {
    .center-content();

    padding: 0;
    width: 100%;
    height: 100%;
    box-shadow: none;
    border-radius: 50%;
  }

  &--nav2 {
    width: @nav2-avatar-height;
    height: @nav2-avatar-height;
    box-shadow: none;
    border-radius: 50%;
    overflow: hidden;
    transition:
      width var(--header-pinned-animation-duration),
      height var(--header-pinned-animation-duration);
    position: relative;

    .@{header-pinned} & {
      width: @nav2-avatar-height--pinned;
      height: @nav2-avatar-height--pinned;
    }

    &.js-click-menu--active,
    &:hover {
      box-shadow: inset 0 0 0 3px hsl(var(--hsl-c1));
    }
  }

  &--navbar-mobile {
    width: @navbar-mobile--content-height;
    height: @navbar-mobile--content-height;
    margin-right: 10px;
  }

  &--profile {
    width: @profile-avatar-size;
    height: @profile-avatar-size;
  }

  &--restricted {
    &::before {
      .full-size();
      content: "";
      background-image: url("~@images/layout/exclamation-icon.svg");
      background-size: 60%;
      background-position: center;
      background-repeat: no-repeat;
      background-color: fade(#000, 60%);
    }
  }
}
